import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 周食谱信息 */
export interface RecipeMenusWeekly {
  menuId: number // 编号
  weekYear?: string // 年份
  weekNumber: string // 第几周
  weekStartDate: string | Dayjs // 周开始日期
  weekEndDate: string | Dayjs // 周结束日期
  remark: string // 备注
  status?: number // 状态
}

// 周食谱 API
export const RecipeMenusWeeklyApi = {
  // 查询周食谱分页
  getRecipeMenusWeeklyPage: async (params: any) => {
    return await request.get({ url: `/school/recipe-menus-weekly/page`, params })
  },

  // 查询周食谱详情
  getRecipeMenusWeekly: async (id: number) => {
    return await request.get({ url: `/school/recipe-menus-weekly/get?id=` + id })
  },

  // 智能创建食谱
  createRecipeMenusWeekly: async (data: any) => {
    return await request.post({ url: `/school/recipe-menus-weekly/create`, data })
  },

  // 审核周食谱
  approveRecipeMenusWeekly: async (params: any) => {
    return await request.put({ url: `/school/recipe-menus-weekly/approve`, params })
  },

  // 修改周食谱
  updateRecipeMenusWeekly: async (data: RecipeMenusWeekly) => {
    return await request.put({ url: `/school/recipe-menus-weekly/update`, data })
  },

  // 删除周食谱
  deleteRecipeMenusWeekly: async (id: number) => {
    return await request.delete({ url: `/school/recipe-menus-weekly/delete?id=` + id })
  },

  /** 批量删除周食谱 */
  deleteRecipeMenusWeeklyList: async (ids: number[]) => {
    return await request.delete({
      url: `/school/recipe-menus-weekly/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出周食谱 Excel
  exportRecipeMenusWeekly: async (params) => {
    return await request.download({ url: `/school/recipe-menus-weekly/export-excel`, params })
  }
}
